import React, { Component } from 'react'

export class Page extends Component {
  render() {
    const {page,pagss,onchangePage,onprevpage,onnext}=this.props
    return (
      <div>
        <button onClick={
          ()=>{
            onchangePage(0)
          }
        } >首页</button>
        <button onClick ={
          ()=>{
            onprevpage()
          }
        
        } disabled={page==0}>上页</button>
        {
          pagss.length ?  pagss.map((item,index)=>{
            return <button className={index===page ?'on' :''  } onClick={()=>{
              onchangePage(index)
            

            }}>{index+1}</button>
          }):'暂无数据'
        }
       <button onClick ={
          ()=>{
           onnext()
          }
        
        } disabled={page==pagss.length-1}>下页</button>
        <button onClick={
          ()=>{
            onchangePage(pagss.length-1)
          }
        }>尾页</button>


      </div>
    )
  }
}

export default Page